<template>
	<view class="content">
		<view class="task_view">
			<view class="">
				任务/月
			</view>
			<view class="">
				月视图
			</view>
		</view>
		<view class="repair_type">
			<view class="charts-box">
				<qiun-data-charts type="column" canvasId="canvasColumn1" :opts="opts1" :chartData="chartData1" :ontouch="true"
				 :canvas2d="true" background="none" />
			</view>
		</view>
		<view class="ranking">
			<view class="ratio">
				设备维修占比排行
			</view>
			<view class="rank_list">
				<mescroll-body class="water_scroll" ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
				 @up="upCallback">
					<view class="rank_item" v-for="i in 10" :key="i">
						<view class="">
							<image src="../../../static/device/shebei.png" mode=""></image>
						</view>
						<view class="item_con">
							<view class="">
								<text>F300矫形部分（30%）</text>
								<text>15次</text>
							</view>
							<view class="item_jdt">
								<view class="">

								</view>
							</view>
						</view>
					</view>
				</mescroll-body>
			</view>
		</view>
	</view>
</template>

<script>
	import zzxCalendar from "@/components/zzx-calendar/zzx-calendar.vue"
	import timeline from '@/components/chenbin-timeline/timeLine.vue'
	import timelineItem from '@/components/chenbin-timeline/timelineItem.vue'
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		components: {
			zzxCalendar,
			timeline,
			timelineItem
		},
		data() {
			return {
				plantTitle: '注塑机',

				downOption: {
					auto: false //是否在初始化后,自动执行downCallback; 默认true
				},
				opts1: {
					"type": "area",
					"canvasId": "",
					"canvas2d": false,
					"background": "none",
					"animation": true,
					"timing": "easeOut",
					"duration": 1000,
					"padding": [
						0,
						0,
						0,
						0
					],
					
					"grid": {
						"top": 0,
						"bottom": 0,
						"right": 0,
						"left": 0
					},
					"rotate": false,
					"errorReload": true,
					"fontSize": 13,
					"fontColor": "#666666",
					"enableScroll": false,
					"touchMoveLimit": 60,
					"enableMarkLine": false,
					"dataLabel": false,
					"dataPointShape": false,
					"dataPointShapeType": "solid",
					"tapLegend": true,
					"xAxis": {
						"disabled": false,
						"axisLine": false,
						"axisLineColor": "#CCCCCC",
						"calibration": false,
						"fontColor": "#bdbdbd",
						"fontSize": 13,
						"rotateLabel": false,
						"itemCount": 5,
						"boundaryGap": "center",
						"disableGrid": true,
						"gridColor": "#bdbdbd",
						"gridType": "solid",
						"dashLength": 4,
						"gridEval": 1,
						"scrollShow": false,
						"scrollAlign": "left",
						"scrollColor": "#A6A6A6",
						"scrollBackgroundColor": "#EFEBEF",
						"format": ""
					},
					"yAxis": {
						"disabled": false,
						"disableGrid": true,
						"splitNumber": 5,
						"gridType": "solid",
						"dashLength": 2,
						"gridColor": "#bdbdbd",
						"padding": 0,
						"showTitle": false,
						"data": [{
							"type": "value",
							"position": "left",
							"disabled": false,
							"axisLine": false,
							"axisLineColor": "#CCCCCC",
							"calibration": false,
							"fontColor": "#bdbdbd",
							"fontSize": 13,
							"textAlign": "right",
							"title": "",
							"titleFontSize": 13,
							"titleOffsetY": 0,
							"titleOffsetX": 0,
							"titleFontColor": "#666666",
							"min": null,
							"max": null,
							"tofix": null,
							"unit": "",
							"format": ""
						}]
					},
					"legend": {
						"show": false,
						"position": "bottom",
						"float": "center",
						"padding": 5,
						"margin": 5,
						"backgroundColor": "rgba(0,0,0,0)",
						"borderColor": "rgba(0,0,0,0)",
						"borderWidth": 0,
						"fontSize": 13,
						"fontColor": "#666666",
						"lineHeight": 11,
						"hiddenColor": "#CECECE",
						"itemGap": 10
					},
					"extra": {
						"area": {
							"type": "curve",
							"opacity": 0.8,
							"addLine": true,
							"width": 2,
							"gradient": true
						},
						"tooltip": {
							"showBox": true,
							"showArrow": true,
							"showCategory": false,
							"borderWidth": 0,
							"borderRadius": 0,
							"borderColor": "#000000",
							"borderOpacity": 0.7,
							"bgColor": "#000000",
							"bgOpacity": 0.7,
							"gridType": "solid",
							"dashLength": 4,
							"gridColor": "#CCCCCC",
							"fontColor": "#FFFFFF",
							"splitLine": true,
							"horizentalLine": false,
							"xAxisLabel": false,
							"yAxisLabel": false,
							"labelBgColor": "#FFFFFF",
							"labelBgOpacity": 0.7,
							"labelFontColor": "#666666"
						},
						"markLine": {
							"type": "solid",
							"dashLength": 4,
							"data": []
						}
					}
				},
				chartData1: {
					"categories": [
						"2016",
						"2017",
						"2018",
						"2019",
						"2020",
						"2021"
					],
					"series": [{
						"name": "成交量A",
						"data": [
							35,
							8,
							25,
							37,
							4,
							20
						]
					}]
				},


			};
		},
		mounted() {},
		methods: {
			datechange(e) {
				console.log(e);
			},

			/*下拉刷新的回调 */
			downCallback() {
				let that = this
				return
				//联网加载数据
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = res.rows
					this.mescroll.endBySize(res.rows.length, res.total)
				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			},
			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
			upCallback(page) {
				//联网加载数据
				return
				this.apis.materialsApi.maMaterialList({
					pageNum: 1,
					pageSize: 10,
					category: this.dictValue,
					materialName: this.materialName
				}).then(res => {
					this.materList = this.materList.concat(res.rows);
					this.mescroll.endBySize(res.rows.length, res.total)

				}).catch(() => {
					//联网失败的回调,隐藏下拉刷新的状态
					this.mescroll.endErr();
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@mixin minIconSize {
		width: 40rpx;
		height: 40rpx;
	}

	.content {
		background: #FFFFFF;
		padding: 0 44rpx;

		.task_view {
			display: flex;
			justify-content: space-between;
			padding: 24rpx 0;
			box-sizing: border-box;
			font-size: 24rpx;
			color: #666666;
		}

		.repair_type {
			box-sizing: border-box;
			border-radius: 24rpx;
			margin-bottom: 20rpx;

			/* 请根据需求修改图表容器尺寸，如果父容器没有高度图表则会显示异常 */
			.charts-box {
				width: 100%;
				height: 400rpx;
			}
		}

		.ranking {
			display: flex;
			flex-direction: column;
			margin-top: 48rpx;

			.ratio {
				font-size: 28rpx;
				color: #333333;
			}

			.rank_list {
				display: flex;
				flex-direction: column;
				overflow-y:scroll;
				height:calc(100vh - 580rpx);

				.rank_item {
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 44rpx;
					padding-bottom: 8rpx;

					image {
						width: 40rpx;
						height: 40rpx;
					}

					.item_con {
						width: 90%;

						view:nth-child(1) {
							display: flex;
							justify-content: space-between;
							margin-bottom: 16rpx;

							text {
								font-size: 24rpx;
								color: #101010;
							}
						}

						.item_jdt {
							background: rgba($color: #000000, $alpha: 0.04);
							height: 8rpx;
							display: flex;
							align-items: center;
							justify-content: flex-start;

							view {
								width: 20%;
								height: 100%;
								background: #F49A19;
							}
						}
					}
				}
			}
		}
	}
</style>
